define(['backend','fast'], function (Backend,Fast) {
    $('body').on('click', '[data-tips-image]', function () {
        var img = new Image();
        var imgWidth = this.getAttribute('data-width') || '500px';
        img.onload = function () {
            var $content = $(img).appendTo('body').css({background: '#fff', width: imgWidth, height: 'auto'});
            Layer.open({
                type: 1, area: imgWidth, title: false, closeBtn: 1,
                skin: 'layui-layer-nobg', shadeClose: true, content: $content,
                end: function () {
                    $(img).remove();
                },
                success: function () {

                }
            });
        };
        img.onerror = function (e) {

        };
        img.src = this.getAttribute('data-tips-image') || this.src;
    });
    $.extend(true, Backend, {
        api:  {
            redirect: function(url, title, icon) {
                var that = top.window.$("ul.nav-addtabs li.active");
                var oldId = that.find('a').attr('node-id')
                //新增窗口
                console.log('title',title)
                Fast.api.addtabs(url, title, icon);

                parent.$("#table").bootstrapTable('refresh', {});
                //关闭原来的
                // top.window.$("ul.nav-addtabs li#tab_" + oldId + " .close-tab").trigger("click");
            },
        }
    });
});